// 3.配置路由项
import Home from '@/pages/Home'
import Login from '@/pages/Login'
import Register from '@/pages/Register'
import Search from '@/pages/Search'
import Detail from '@/pages/Detail'
import AddCartSuccess from '@/pages/AddCartSuccess'
import ShopCart from '@/pages/ShopCart'
import Trade from '@/pages/Trade'
import Pay from '@/pages/Pay'
import PaySuccess from '@/pages/PaySuccess'
import Center from '@/pages/Center'

const routes = [{
        path: '/home',
        name: 'home',
        component: Home,
        meta:{
            isHiddenNav: true // 是否显示左侧导航
        }
    },
    {
        path: '/login',
        name: 'login',
        component: Login,
        meta: { // 路由元信息，添加自定义的属性存储一些信息
            isHiddenFooter: true
        }
    },
    {
        path: '/register',
        name: 'register',
        component: Register,
        meta: {
            isHiddenFooter:true
        }
    },
    {
        path: '/search/:keyword?',
        name: 'search',
        component: Search
    },
    {
        name: 'detail',
        path: '/detail/:id',
        component:Detail,
        props:true  // 在组件内可以使用该方式来获取对应的params参数
    },
    {
        path:'/addCartSuccess',
        name:'addCartSuccess',
        component:AddCartSuccess
    },
    {
        name:'shopCart',
        path:'/shopCart',
        component:ShopCart
    },
    {
        // 结算中心 在这个里面有收货的地址和购买的商品
        name: 'trade',
        path: '/trade',
        component:Trade 
      },
      {
        // 付款界面 支付媒介 
        name: 'pay',
        path: '/pay',
        component:Pay
      },
      { 
        // 支持成功的界面
        name: 'paysuccess',
        path: '/paySuccess',
        component:PaySuccess
      },
      {
        // 最后支付完成之后查看的之前的购物清单
        name: 'center',
        path: '/center',
        component:Center
      },
    {
        path: '/',
        redirect: '/home'
        // component: Home
    }
    
]
export default routes